Computer graphics are being used today to perform a wide variety of tasks. Many different areas of business, industry, government, education, entertainment, and most recently, the home, are tapping into the enormous and rapidly growing list of applications developed for today's increasingly powerful computer devices.
Graphics have also become a key technology for communicating ideas, data, and trends in most areas of commerce, science, and education. Until recently, real time user interaction with three dimensional (3D) models and pseudo-realistic images was feasible on only very high performance workstations. These workstations contain dedicated, special purpose graphics hardware. The progress of semiconductor fabrication technology has made it possible to do real time 3D animation, with color shaded images of complex objects, described by thousands of polygons, on powerful dedicated rendering subsystems. The most recent and most powerful workstations are capable of rendering completely life-like, realistically lighted, 3D objects and structures.
In a typical 3D computer generated object, the surfaces of the 3D object are described by data models. These data models store "primitives" (usually mathematically described polygons and polyhedra) that define the shape of the object, the object attributes, and the connectivity and positioning data describing how the objects fit together. The component polygons and polyhedra connect at common edges defined in terms of common vertices and enclosed volumes. The polygons are textured, Z-buffered, and shaded onto an array of pixels, creating a realistic 3D image.
In a typical graphics computer, most of the actual rendering computation is performed by a graphics subsystem included in the graphics computer. The 3D object data models are "traversed" by a software program (e.g., in response to user input) running on one or more processors in a processor subsystem within the graphics computer. The primitives describing the 3D object are processed by the processor subsystem and sent to the graphics subsystem for rendering. For example, a 3D polyhedra model of an object is sent to the graphics subsystem as contiguous strips of polygons, sent to the graphics subsystem as a graphics data stream (e.g., primitives, rendering commands, instructions, etc.). This graphics data stream, sometimes referred to as a command data stream, provides the graphics subsystem with all the information required to render the 3D object and the resulting scene. Such information includes, for example, specular highlighting, anti-aliasing, depth, transparency, and the like. Using this information, the graphics subsystem performs all the computational processing required to realistically render the 3D object. The hardware of the graphics subsystem is specially tuned to perform such processing quickly and efficiently in comparison to the processor subsystem.
To facilitate fast and efficient graphics processing, typical graphics subsystems include a command buffer which "buffers" the incoming command data stream. The command buffer functions as a FIFO (first-in-first-out buffer) for the incoming command data stream, thereby allowing the graphics subsystem to continue functioning nominally in those instances where the command data stream coming from the processor subsystem arrives in "bursts". This enables the graphics subsystem to continue processing the command data stream, and thus, continue its rendering at its nominal rate, even though the command data stream from the processor subsystem is briefly interrupted from time to time.
There exists a problem, however, with regard to context switching. Inside the graphics pipeline of the graphics subsystem, there is a large amount of "rendering state" maintained in the hardware of the pipeline at any given time. The rendering state is typically comprised of the graphics commands and data which describe the lighting parameters, textures, primitives, matrices, modes, etc., required to render a scene. Typically, the more complex the rendering process, e.g., the more realistic and more detailed the rendering process, the larger the rendering state. Hence, the rendering state for high performance graphics subsystems can be quite large when all the lighting parameters, matrices, modes, texture memory, and the like are considered. The inclusion of a large command buffer further increases the size of the rendering state.
In contrast, for example, the rendering states for typical 2D scenes are much smaller. In addition to 3D graphics, most graphics computers also extensively use 2D graphics, particularly within a windowing, graphical user interface (e.g., X Windows). These 2D windowing applications usually support multiple 2D "windows" for each process thread running on the processor subsystem. Switching between these 2D windows, e.g., due to some user input, is acceptably fast due to the fact that for typical 2D operations, each rendering process (e.g., for each window) has a very small rendering state in comparison to a typical 3D scene. Hence, even though an application may switch contexts frequently, the setup overhead for the context switching between the 2D windows is small. When the graphics computer runs multiple 3D graphics programs and switches context between them, or when the computer switches between 2D and 3D processes, the setup overhead for the large 3D rendering state(s) is much larger. Accordingly, the graphics computer suffers a large performance penalty when switching context in such situations, especially when the graphics subsystem includes a large command buffer coupled to the graphics pipeline.
Thus, what is required is a method and system which implements efficient context switching in a graphics computer system. What is required is a system which efficiently implements context switching between multiple 3D processes being rendered in a graphics subsystem of the graphics computer. What is further required is a system which does not impose a performance penalty when context switching between processes. In addition, what is required is a system which supports the inclusion of a large command buffer in the graphics subsystem for improved performance without imposing a performance penalty during context switching. The present invention provides a novel solution to the above requirements.